package com.ruoyi.state;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author syc
 * @Date Created in 15:25 2022/8/18
 * @Description
 */
public class TestSleep2 {
    public static void main(String[] args) throws InterruptedException {
      //  djs();
      // 打印系统当前时间
        Date starTime = new Date(System.currentTimeMillis()); // 获取系统当前时间
        while (true) {
           Thread.sleep(1000);
            System.out.println(new SimpleDateFormat("HH:mm:ss").format(starTime));
            starTime = new Date(System.currentTimeMillis());

        }



    }
    //模拟倒计时
    public static void  djs() throws InterruptedException {
        int n = 10;
        while (true) {
            Thread.sleep(1000);
            System.out.println(n--);
            if(n <= 0) {
                break;
            }
        }

    }





}
